<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCataLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cata_logs', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('order')->default(1);           // 章节排序
            $table->integer('course_id');
            $table->string('name', 255);
            $table->string('thumb', 255)->nullable();
            $table->tinyInteger('type')->default(0);              // 1 = 视频， 2 = 音频， 3 = 图文
            $table->decimal('price')->default(0);                 // 单节费用
            $table->integer('give_integral')->default(0);         // 赠送积分
            $table->integer('exchange_integral')->default(0);     // 可兑换积分数
            $table->string('audio_path', 255)->nullable();
            $table->string('video_path', 255)->nullable();
            $table->text('body')->nullable();
            $table->decimal('bonus_ratio_1')->default(0);
            $table->decimal('bonus_ratio_2')->default(0);
            $table->tinyInteger('status')->default(1);             // 审核状态，0=未通过，1=已通过
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cata_logs');
    }
}
